<html>
  <head>
    <meta charset="utf-8">
    <title>Modals</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <link href="../../dist/css/ionic.css" rel="stylesheet">
  </head>
  <body>

    <section>

      <header class="bar bar-header bar-dark">
        <h1 class="title">Modals</h1>
      </header>

      <main class="content padding has-header">
        <a href="#" class="button button-warning" id="modal-opener">Open Modal</a>
        <p><a class="button button-secondary" href="index.html">Homepage</a></p>
      </main>

    </section>

    <div id="modal" class="modal slide-in-up">
      <header class="bar bar-header bar-secondary">
        <h1 class="title">BOOM</h1>
        <a href="#" class="button" id="modal-closer">Close</a>
      </header>

      <main class="content padding has-header">
        <h2>I'm a thing</h2>
        <div style="background-color: blue; width: 100%; height: 1000px"></div>
      </main>
    </div>

    <script src="../../dist/js/ionic.js"></script>
    <script>
      var open = document.getElementById('modal-opener');
      var anim = ionic.Animator.animate(modal, function() {
        console.log('Animation finished');
      });

      ionic.on('tap', function(e) {
        var modal = document.getElementById('modal');
        modal.classList.add('active');
        anim.enter();
        return false;
      }, open);

      var closer = document.getElementById('modal-closer');
      ionic.on('tap', function(e) {
        var modal = document.getElementById('modal');
        modal.classList.remove('active');
        anim.leave();
        return false;
      }, closer);
    </script>
    
  </body>
</html>
